import React, {Component} from 'react';

export default class App extends Component {

    state = {
        username:'',
        password:''
    }

    setUser = (e)=>{

        this.setState({username:e.target.value})
    }

    setPwd = (e)=>{

        this.setState({password:e.target.value})
    }


    render() {
        const {username,password} = this.state
        return (
            <div>
               用户名: <input type="text"  onChange={this.setUser}/>
               <h1>用户名是:{username}</h1>
               密码:  <input type="password" onChange={this.setPwd}/>
               <h1>密码是:{password}</h1>
            </div>
        );
    }
}


